package com.mzy.datepackage.M2022.Jan.twth;

import java.util.Stack;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author mzy
 * @Date 2022/1/23 18:37
 * @Version 1.0
 */

/**
 * pop 方法移除并返回栈顶元素
 * peek 方法提供栈顶元素
 * push 方法压栈
 */
public class staticTest {
    public static void main(String[] args) {
        Stack<String> stack = new Stack<>();
        for (String s :
                "MY IS A PET".split(" "))
            stack.push(s);
        while (!stack.isEmpty())
            System.out.println(stack.pop() + " ");
    }
}
